package com.maple.file.utils;

import java.io.File;
import java.io.FileOutputStream;

/**
 * 文件工具类
 * maple
 */
public class FileUtil {

    /**
     * 处理文件本地上传
     */
    public static void uploadFile(byte[] file, String filePath, String fileName) throws Exception {
        File targetFile = new File(filePath);
        if (!targetFile.exists()) {
            targetFile.mkdirs();
        }

        try (FileOutputStream out = new FileOutputStream(filePath + fileName)) {
            out.write(file);
            out.flush();
        }
    }


}
